# $Id: PKGBUILD 179894 2013-03-11 02:37:23Z dan $
# Maintainer: Dan McGee <dan@archlinux.org>
# Contributor: Sebastien Binet <binet@lblbox>

pkgname=('python-pip' 'python2-pip')
pkgver=1.3.1
pkgrel=1
pkgdesc="An easy_install replacement for installing pypi python packages"
url="http://www.pip-installer.org/"
arch=('any')
license=('MIT')
makedepends=('python' 'python-distribute' 'python2' 'python2-distribute')
source=(http://pypi.python.org/packages/source/p/pip/pip-${pkgver}.tar.gz)

package_python-pip() {
  depends=('python' 'python-distribute')

  cd "$srcdir/pip-$pkgver"
  python setup.py build
  python setup.py install --prefix=/usr --root="$pkgdir"
  
  ln "$pkgdir/usr/bin/pip" "$pkgdir/usr/bin/pip3"

  install -D -m644 LICENSE.txt \
	  "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_python2-pip() {
  depends=('python2' 'python2-distribute')
  conflicts=('python-pyinstall')
  replaces=('python-pyinstall')

  cd "$srcdir/pip-$pkgver"
  python2 setup.py build
  python2 setup.py install --prefix=/usr --root="$pkgdir"
  
  mv "$pkgdir/usr/bin/pip" "$pkgdir/usr/bin/pip2"
  sed -i "s|#!/usr/bin/env python$|#!/usr/bin/env python2|" \
    ${pkgdir}/usr/lib/python2.7/site-packages/pip/__init__.py
  
  install -D -m644 LICENSE.txt \
	  "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

md5sums=('cbb27a191cebc58997c4da8513863153')
sha256sums=('145eaa5d1ea1b062663da1f3a97780d7edea4c63c68a37c463b1deedf7bb4957')
